package com.qingcloud.adminbackend.entity.app;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author wangjinnan
 * @since 2021-01-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("df_job_component_instance")
public class JobComponentInstance implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，公用开发作业组件实例主键
     */
    @TableId(type = IdType.INPUT)
    @ApiModelProperty(value = "主键ID", example = "1")
    private Integer id;

    /**
     * 作业ID
     */
    @ApiModelProperty(value = "作业ID", example = "1")
    private Integer jobId;

    /**
     * 连接的上一个实例
     */
    @ApiModelProperty(value = "连接的上一个实例", example = "1")
    private Integer parentId;

    /**
     * 作业名称
     */
    @ApiModelProperty(value = "作业名称", example = "1")
    private String jobName;

    /**
     * 实例名称
     */
    @ApiModelProperty(value = "实例名称", example = "1")
    private String name;

    /**
     * 组件项目名称
     */
    @ApiModelProperty(value = "组件项目名称", example = "1")
    @TableField(exist = false)
    private String softwareName;

    /**
     * 全局组件ID
     */
    @ApiModelProperty(value = "全局组件ID", example = "1")
    private Integer componentId;

    /**
     * 全局组件名称
     */
    @ApiModelProperty(value = "全局组件名称", example = "1")
    private String componentName;

    /**
     * 采集器cron表达式
     */
    @ApiModelProperty(value = "采集器cron表达式", example = "0 1/10 * * * ?")
    @TableField(exist = false)
    private String cron;

    /**
     * 组件类型 1-采集器，2-接收器，3-转换器，4-存储器
     */
    @ApiModelProperty(value = "组件类型 1-采集器，2-接收器，3-转换器，4-存储器", example = "1")
    private Integer type;

    @ApiModelProperty(value = "组件运行方式 1-定时调度，2-独立运行", example = "1")
    private Integer runType;
    /**
     * 组件运行方式 1-独立式，2-嵌入式
     */
    @ApiModelProperty(value = "组件部署方式 在jvm中启动，还是独立进程 1-独立式，2-嵌入式", example = "1")
    private Integer runMode;

    /**
     * 开发语言，1-JAVA
     */
    @ApiModelProperty(value = "开发语言，1-JAVA", example = "1")
    private Integer lang;


    /**
     * 实例状态
     */
    @ApiModelProperty(value = "实例状态", example = "1")
    private Integer state;
    /**
     * 版本号
     */
    @ApiModelProperty(value = "版本号", example = "1")
    private String ver;

    /**
     * 执行文件路径
     */
    @ApiModelProperty(value = "执行文件路径", example = "1")
    private String filePath;

    /**
     * 实例唯一消息队列主题
     */
    @ApiModelProperty(value = "实例唯一消息队列主题", example = "1")
    private String topic;

    /**
     * 实例唯一消息队列主题
     */
    @ApiModelProperty(value = "实例唯一收响应消息主题", example = "1")
    private String responseTopic;

    /**
     * 组件布局的X坐标
     */
    @ApiModelProperty(value = "组件布局的X坐标", example = "20")
    @NotNull
    private Integer x;
    /**
     * 组件布局的Y坐标
     */
    @ApiModelProperty(value = "组件布局的Y坐标", example = "20")
    @NotNull
    private Integer y;
    /**
     * 最新版本号
     */
    @ApiModelProperty(value = "最新版本号", example = "1")
    @TableField(exist = false)
    private String newestVer;

    @ApiModelProperty(value = "字典图标", example = "")
    @TableField(exist = false)
    private String icon;

    @ApiModelProperty(value = "字典图标颜色", example = "")
    @TableField(exist = false)
    private String color;

    @ApiModelProperty(value = "运行服务器ip", example = "127.0.0.1")
    @TableField(exist = false)
    private String server;

    @ApiModelProperty(value = "运行端口", example = "8080")
    @TableField(exist = false)
    private Integer port;

    @ApiModelProperty(value = "文件名字", example = "xxx.jar")
    @TableField(exist = false)
    private String fileName;
    /**
     * 来源名称
     */
    @ApiModelProperty(value = "来源名称", example = "1")
    @TableField(exist = false)
    private String sourceName;

    @ApiModelProperty(value = "数据源topic", example = "1")
    @TableField(exist = false)
    private String fromTopic;

    @ApiModelProperty(value = "目标表", example = "test")
    @TableField(exist = false)
    private String outTable;

    /**
     * 数据来源提供方Name
     */
    @ApiModelProperty(value = "数据来源提供方Name", example = "1")
    @TableField(exist = false)
    private String providerName;

    /**
     * 数据资源格式
     */
    @ApiModelProperty(value = "数据资源格式名称", example = "1")
    @TableField(exist = false)
    private String dataFormatName;

    /**
     * 数据频率
     */
    @ApiModelProperty(value = "数据频率", example = "1")
    @TableField(exist = false)
    private Integer dataFrequency;


    @ApiModelProperty(value = "最近执行时间", example = "1")
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    /**
     * 发布时间
     */
    @ApiModelProperty(value = "发布时间", example = "2021-01-11 10:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime publishTime;

}
